package com.abss.vote.service.impl;

import com.abss.vote.mapper.LogoMapper;
import com.abss.vote.model.Administrators;
import com.abss.vote.model.Logo;
import com.abss.vote.service.LogoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LogoServiceImpl implements LogoService {

    @Autowired
    private LogoMapper logoMapper;



    @Override
    public Logo getLogoByServerId(Administrators ad) {
        //首先获取服务器的logo
        Logo logo=logoMapper.getLogos(ad.getADMIN());
        if(logo==null){
            return null;
        }
        //获取管理员头像
        String face_img = logoMapper.getAdminFace(ad.getID());
        if (!"".equals(face_img)||"null".equals(face_img)) {
            logo.setFACE_IMG(face_img);
        }

        return logo;
    }


    @Override
    public int updateLogoImg(Logo lo) {
        return logoMapper.updateLogoImg(lo);
    }

    @Override
    public int updateFanceImg(Logo lo) {
        return logoMapper.updateFanceImg(lo);
    }

    @Override
    public int updateWx(Logo lo) {
        return logoMapper.updateWx(lo);
    }

    @Override
    public int updateFace(Administrators ad) {
        return logoMapper.updateFace(ad);
    }
}
